package com.chinadci.smartcommunitysystembackstage.mapper;

import com.chinadci.smartcommunitysystembackstage.entity.ScsOwner;
import com.chinadci.smartcommunitysystembackstage.entity.ScsPay;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chinadci.smartcommunitysystembackstage.entity.ScsPayType;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Code Duck
 * @since 2021-04-13
 */
public interface ScsPayMapper extends BaseMapper<ScsPay> {
    //显示所有缴费类型
    @Select("select * from scs_pay")
    @Results({
            @Result(id = true,column = "p_id",property = "pId"),
            @Result(column = "p_number",property = "pNumber"),
            @Result(column = "p_money",property = "pMoney"),
            @Result(column = "p_create_time",property = "pCreateTime"),
            @Result(column = "o_id",property = "ownerList",many =@Many(select = "Selects")),
            @Result(column = "pt_id",property = "typeList",many = @Many(select = "Select"))
    })
    List<ScsPay> Find();

    @Select("select * from scs_pay_type where pt_id=#{pt_id}")
    List<ScsPayType> Select(int id);

    @Select("select * from scs_owner where o_id=#{pt_id}")
    List<ScsOwner> Selects(int id);

    //显示所有缴费类型
    @Select("select * from scs_pay where o_id=#{id}")
    @Results({
            @Result(id = true,column = "p_id",property = "pId"),
            @Result(column = "p_number",property = "pNumber"),
            @Result(column = "p_money",property = "pMoney"),
            @Result(column = "p_create_time",property = "pCreateTime"),
            @Result(column = "o_id",property = "ownerList",many = @Many(select = "Selects")),
            @Result(column = "pt_id",property = "typeList",many = @Many(select = "Select"))
    })
    List<ScsPay> Finds(int id);

}
